package com.atguigu.test.infrastructure;

import com.alibaba.fastjson.JSON;
import com.atguigu.domain.strategy.model.vo.RuleTreeVO;
import com.atguigu.domain.strategy.respository.IStrategyRepository;
import com.atguigu.infrastructure.persistent.dao.IStrategyDao;
import com.atguigu.infrastructure.persistent.po.Strategy;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

@SpringBootTest
@Slf4j
@RunWith(SpringRunner.class)
public class TestStrategy {

    @Resource
    private IStrategyDao strategyDao;
    @Resource
    private IStrategyRepository strategyRepository;

    @Test
    public void test_queryStrategyList() {
        List<Strategy> strategies = strategyDao.queryStrategyList();
        log.info("strategyDao: {}", JSON.toJSONString(strategies));
    }

    @Test
    public void test_queryRuleTreeVOBYTreeId(){
        RuleTreeVO ruleTreeVO = strategyRepository.queryRuleTreeVOBYTreeId("tree_lock_1");
        log.info("ruleTressVO: {}",  JSON.toJSONString(ruleTreeVO));
    }
}
